package com.vhly.tuite;

import android.app.Activity;
import android.app.TabActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TabHost;
import com.vhly.tuite.twclient.client.TwitterClient;

/**
 * Created by IntelliJ IDEA.
 * User: vhly
 * Date: 2010-7-28
 * Time: 10:53:46
 *
 * @author vhly[FR]
 */
public class TabMainActivity extends TabActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TabHost tabHost = getTabHost();
        Resources res = getResources();
        String tn = res.getString(R.string.tweets);
        String sn = res.getString(R.string.settings);
        String an = res.getString(R.string.about);

        SharedPreferences sharedPreferences = getSharedPreferences("tt", MODE_WORLD_READABLE | MODE_WORLD_WRITEABLE);
        String ac = sharedPreferences.getString("tu", "vhly@163.com");
        String p = sharedPreferences.getString("tp", "fiverats");
        TwitterClient client = TwitterClient.getInstance();
        client.init(ac, p);

        tabHost.addTab(tabHost.newTabSpec(tn).setIndicator(tn).setContent(new Intent(this,TweetListActivity.class)));
        tabHost.addTab(tabHost.newTabSpec(sn).setIndicator(sn).setContent(new Intent(this,SettingActivity.class)));
        tabHost.addTab(tabHost.newTabSpec(an).setIndicator(an).setContent(new Intent(this,AboutActivity.class)));
    }
}
